<?php
declare(strict_types = 1);

namespace leruge\command;

use think\console\Command;

class Business extends Command
{
    public function configure()
    {
        $this->setName('business')
            ->setDescription('win下business启动');
    }

    public function handle()
    {
        $this->output->info('business启动');
        $registerAddress = config('chat.register_address') ?: '127.0.0.1:1201';
        $worker = new \GatewayWorker\BusinessWorker();
        $worker->registerAddress = $registerAddress;
        $worker->name = config('chat.business_name') ?: 'business';
        $worker->count = 1;
        $worker->eventHandler = config('chat.event_handler') ?: \leruge\Events::class;
        \Workerman\Worker::runAll();
    }
}